package com.qf.controller;


import com.qf.model.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Date;
import java.util.List;


@Controller
@RequestMapping("user/")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("todemo")
    public String toDemo(){

        return "demo01";
    }

    @RequestMapping("show")
    public String show(Model model){
        model.addAttribute("msg","show方法");
        User user = userService.getById(6);
        model.addAttribute("user",user);
        model.addAttribute("time",new Date());
        List<User> list = userService.list();
        model.addAttribute("list",list);
        return "demo01";
    }



}
